package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbGpssjbb;
import com.ruoyi.tjbb.service.ISysTjbbGpssjbbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * GPS数据报Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/xsfx/gpssjbb")
public class SysTjbbGpssjbbController extends BaseController
{
    @Autowired
    private ISysTjbbGpssjbbService sysTjbbGpssjbbService;

    /**
     * 查询GPS数据报列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:gpssjbb:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbGpssjbb sysTjbbGpssjbb)
    {
        startPage();
        List<SysTjbbGpssjbb> list = sysTjbbGpssjbbService.selectSysTjbbGpssjbbList(sysTjbbGpssjbb);
        return getDataTable(list);
    }

    /**
     * 导出GPS数据报列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:gpssjbb:export')")
    @Log(title = "GPS数据报", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbGpssjbb sysTjbbGpssjbb)
    {
        List<SysTjbbGpssjbb> list = sysTjbbGpssjbbService.selectSysTjbbGpssjbbList(sysTjbbGpssjbb);
        ExcelUtil<SysTjbbGpssjbb> util = new ExcelUtil<SysTjbbGpssjbb>(SysTjbbGpssjbb.class);
        util.exportExcel(response, list, "GPS数据报数据");
    }

    /**
     * 获取GPS数据报详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:gpssjbb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbGpssjbbService.selectSysTjbbGpssjbbById(id));
    }

    /**
     * 新增GPS数据报
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:gpssjbb:add')")
    @Log(title = "GPS数据报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbGpssjbb sysTjbbGpssjbb)
    {
        return toAjax(sysTjbbGpssjbbService.insertSysTjbbGpssjbb(sysTjbbGpssjbb));
    }

    /**
     * 修改GPS数据报
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:gpssjbb:edit')")
    @Log(title = "GPS数据报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbGpssjbb sysTjbbGpssjbb)
    {
        return toAjax(sysTjbbGpssjbbService.updateSysTjbbGpssjbb(sysTjbbGpssjbb));
    }

    /**
     * 删除GPS数据报
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:gpssjbb:remove')")
    @Log(title = "GPS数据报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbGpssjbbService.deleteSysTjbbGpssjbbByIds(ids));
    }
}
